    $.fn.pageBar = function(options) {  
        var configs = {  
            PageIndex: 1,       //设置当前页码  
            PageSize: 15,       //设置分页大小  
            TotalPage: 0,       //设置总页数
            RecordCount: 0,     //设置数据总数
            showPageCount: 4,  
            onPageClick: function(pageIndex) {  
                return false;   //默认的翻页事件  
            }  
        }  
        $.extend(configs, options);
        var tmp = "",  
        i = 0,  
        j = 0,  
        a = 0,  
        b = 0,  
        totalpage = parseInt(configs.RecordCount / configs.PageSize);  
        totalpage = configs.RecordCount % configs.PageSize > 0 ? totalpage + 1 : totalpage;  
        // tmp += "<span>总记录数：" + configs.RecordCount + "</span > ";  
        // tmp += " <span>页数：" + totalpage + "</span>";  
        if (configs.PageIndex > 1) {  
            tmp += '<li><a href="javascript:;">&laquo;</a></li>';
        } else {  
            tmp += '<li class="am-disabled"><a href="javascript:;">&laquo;</a></li>';  
        }  
        tmp += '<li><a href="javascript:;">1</a></li>';
        if (totalpage > configs.showPageCount + 1) {  
            if (configs.PageIndex <= configs.showPageCount) {  
                i = 2;  
                j = i + configs.showPageCount;  
                a = 1;  
            } else if (configs.PageIndex > totalpage - configs.showPageCount) {  
                i = totalpage - configs.showPageCount;  
                j = totalpage;  
                b = 1;  
            } else {  
                var k = parseInt((configs.showPageCount - 1) / 2);  
                i = configs.PageIndex - k;  
                j = configs.PageIndex + k + 1;  
                a = 1;  
                b = 1;  
                if ((configs.showPageCount - 1) % 2) {  
                    i -= 1  
                }  
            }  
        }  
        else {  
            i = 2;  
            j = totalpage;  
        }  
        if (b) {  
            tmp += '<li><span>...</span></li>'  
        }  
        for (; i < j; i++) {  
            tmp += '<li><a href="javascript:;">'+ i +'</a></li>'  
        }  
        if (a) {  
            tmp += '<li><span>...</span></li>'  
        }  
        if (totalpage > 1) {  
            tmp += '<li><a href="javascript:;">'+ totalpage +'</a></li>'
        }  
        if (configs.PageIndex < totalpage) {  
            tmp += '<li><a href="javascript:;">&raquo;</a></li>'  
        } else {  
            tmp += '<li class="am-disabled"><a href="javascript:;">&raquo;</a></li>'  
        }  
        if (totalpage > 1) {
            tmp += '<span style="padding: 14px;">共'+ totalpage + '页</span>'; 
            tmp += '到第<input type="text" style="height: 35px;width: 44px;padding: 6px;"/></form>页<a href="javascript:;">确定</a>'  
        }
        
        var pager = this.html(tmp);
        // console.log(pager)
        var index = pager.find('input');  
        pager.find('a').on("click",function() {  
            var lists = $(this).parent("li").attr('class');
            var cls = $(this).attr('class');  
            if ($(this).text() == "«") {  
                if (cls != 'am-disabled') {  
                    configs.onPageClick(parseInt(configs.PageIndex) - 1);
                }  
            } else if ($(this).text() == "»") { 
                if (cls != 'am-disabled') {  
                    configs.onPageClick(parseInt(configs.PageIndex) + 1);
                }  
            } else if (this.innerHTML == '确定') {
                if (IsNum(index.val())) {
                    var indexvalue = parseInt(index.val());  
                    indexvalue = indexvalue < 1 ? 1 : indexvalue;
                    indexvalue = indexvalue > totalpage ? totalpage : indexvalue;
                    configs.onPageClick(indexvalue);
                }else{
                    alert("请输入大于0的整数");
                    index.val("");
                }
            } else {  
                if (lists != 'am-active') {  
                    configs.onPageClick(parseInt(this.innerHTML));  
                }  
            }  
        }).each(function() {  
            if (configs.PageIndex == parseInt(this.innerHTML)) {  
                $(this).parent("li").addClass('am-active');
            }
        });
    }
    function IsNum(num){
        var reNum=/^[0-9]*[1-9][0-9]*$/;
        return(reNum.test(num));
    }